package com.foryou.wechat.exception;

import com.foryou.wechat.utils.Response;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


/**
 * 异常处理器
 *
 * Created by LJX
 * 2017/12/16 0016 下午 9:43
 */
@RestControllerAdvice
@Slf4j
public class RuntimeExceptionHandler {

	/**
	 * 自定义异常
	 */
	@ExceptionHandler(Exception.class)
	public Response handleException(Exception e){
		log.info("[异常捕获]:{}",e.getMessage());
		e.printStackTrace();
		return Response.failure(1,"系统异常！");
	}

}
